package base.controller;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * testing concept of the error handle in servlet.
 */
public class ErrorHandler extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public ErrorHandler() {
	super();
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request,
	    HttpServletResponse response) throws ServletException, IOException {
	doPost(request, response);
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doPost(HttpServletRequest request,
	    HttpServletResponse response) throws ServletException, IOException {

	response.setStatus(response.SC_NOT_FOUND);
	// RequestDispatcher requestDispatcher = request
	// .getRequestDispatcher("/WEB-INF/views/errortest.jsp");
	// requestDispatcher.forward(request, response);
	// response
	// .sendError(response.SC_NOT_FOUND,
	// "testing the error page generated by tomcat is successed------------");
    }

}
